# 杨辉三角 II
class Solution:
    def getRow(self, rowIndex: int):
        if rowIndex == 0:
            return [1]
        result = [1, 1]
        for i in range(1, rowIndex+1):
            tmp = [1 for _ in range(i + 1)]
            for j in range(1, i):
                tmp[j] = result[j - 1] + result[j]
            result = tmp
        return result


if __name__ == '__main__':
    so = Solution()

    r = so.getRow(3)
    print(r)
